<?php
namespace Admin\Controller;

class MovieActorController extends AdminController
{
	//主演管理首页
	public function index ()
	{
		$id =I('get.id/d');
		$data = M ('actor_movie')->where('mid='.$id)->select();
		$this->assign ('list',$data);
		$this->assign ('d',$id);
		$this->display ();
	}
	//主演管理添加页
	public function add ()
	{
		$mid = I('get.mid/d');
		$this->assign ('mid',$mid);
		$this->display();
	}
	public function insert ()
	{
		//var_dump($_POST);exit;
		$movieactor = D ('actor_movie');
		if (!$movieactor->create ()) {
			$this->error ($movieactor->getError ());
		} else {
			if ($movieactor->add () > 0) {
				$this->success ('添加成功',U('MovieActor/index',array('id'=>$_POST['mid'])));
			} else {
				$this->error ('添加失败');
			}
		}
	}
	public function delete ()
	{
		$aid = I ('get.aid/d');
		//var_dump($aid);exit;
		if (M('actor_movie')->delete ($aid) > 0) {
			$this->success ('删除成功');
		} else {
			$this->error ('删除失败');
		}
	}
}